package com.zhangyusheng.easyecharts.factory;
import com.zhangyusheng.easyecharts.component.*;
import com.zhangyusheng.easyecharts.option.EChartsOption;

import java.util.List;

public class EChartFactory {
    /**
     *
     * TODO: 折线图配置工厂
     * @email zhangys_0217@sina.com
     * @since 2025/11/3 22:32
     * @param title
     * @param xAxis
     * @param yAxis
     * @param seriesList
     * @param color  自定义颜色
     * @return
     */
    public static EChartsOption createLineChart(Title title, XAxis xAxis, YAxis yAxis, List<Series> seriesList, List<String> color){
        EChartsOption.Builder builder = new  EChartsOption.Builder()
                .color( color)
                .title(title)
                .xAxis(xAxis)
                .yAxis(yAxis)
                .series(seriesList);
        return builder.build();

    }

    /**
     *
     * TODO: 柱状图配置工厂
     * @email zhangys_0217@sina.com
     * @since 2025/11/3 22:32
     * @param title
     * @param xAxis
     * @param yAxis
     * @param seriesList
     * @param color
     * @return
     */
    public static EChartsOption createBarChart(Title title, XAxis xAxis, YAxis yAxis, List<Series> seriesList, List<String> color, Grid grid, Tooltip tooltip){
        EChartsOption.Builder builder = new  EChartsOption.Builder()
                .color( color)
                .title(title)
                .xAxis(xAxis)
                .yAxis(yAxis)
                .series(seriesList)
                .tooltip(tooltip)
                .grid(grid);
        return builder.build();

    }
}
